

#include "PorepressureOutflowADBC.h"
#include "libmesh/meshfree_interpolation.h"
#include "libmesh/system.h"
#include "libmesh/radial_basis_interpolation.h"
registerMooseObject("TrilobitaApp", PorepressureOutflowADBC);
InputParameters
PorepressureOutflowADBC::validParams()
{
	InputParameters params = ADIntegratedBC::validParams();
	params.addParam<Real>("Pe", 1e5, "environment pressure");
	params.addParam<Real>("L", 1e-4, "distance from the model");
	return params;
}

PorepressureOutflowADBC::PorepressureOutflowADBC(const InputParameters& parameters) :
	ADIntegratedBC(parameters),
	_rhog(getADMaterialProperty<Real>("pyrolysis_gas_density")),
	_permeability(getADMaterialProperty<Real>("permeability")),
	_viscosity(getADMaterialProperty<Real>("pyrolysis_gas_viscosity"))

{
	_Pe = getParam<Real>("Pe");
	_L = getParam<Real>("L");
}


ADReal
PorepressureOutflowADBC::computeQpResidual()
{
	ADReal massflux = _rhog[_qp] * _permeability[_qp] *(_u[_qp] - _Pe)/(_viscosity[_qp] * _L);
	return _test[_i][_qp] * massflux;
}





